package com.yj.web.WeChat.Message;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamConverter;
import com.yj.web.WeChat.Bean.NewsBuilder;
import com.yj.web.WeChat.Bean.TextBuilder;
import com.yj.web.WeChat.Bean.TransferCustomerServiceBuilder;
import com.yj.web.util.XStreamCDataConverter;
import com.yj.web.util.XStreamTransformer;
import lombok.Data;

import java.io.Serializable;

/**
 * Created by yanlinyang on 2017/9/10.
 */
@Data
@XStreamAlias("xml")
public class WxXmlOutMessage implements Serializable {
    private static final long serialVersionUID = -381382011286216263L;

    @XStreamAlias("ToUserName")
    @XStreamConverter(value = XStreamCDataConverter.class)
    protected String toUserName;

    @XStreamAlias("FromUserName")
    @XStreamConverter(value = XStreamCDataConverter.class)
    protected String fromUserName;

    @XStreamAlias("CreateTime")
    protected Long createTime;

    @XStreamAlias("MsgType")
    @XStreamConverter(value = XStreamCDataConverter.class)
    protected String msgType;

    public static TextBuilder TEXT() {
        return new TextBuilder();
    }

    public static NewsBuilder NEWS() {
        return new NewsBuilder();
    }

    public String toXml() {
        return XStreamTransformer.toXml((Class) this.getClass(), this);
    }

    public static TransferCustomerServiceBuilder TRANSFER_CUSTOMER_SERVICE() {
        return new TransferCustomerServiceBuilder();
    }
}
